/*
 *************************************************************************
 *西瑞克斯研发管理系统
 *版 本: 1.0   
 *日 期：02/08/2012    
 *作 者： 王浩 QQ：873987060   
 *************************************************************************   
 */
package com.application.usertable.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.application.role.entity.Role;
import com.manager.IBaseBean;
import com.manager.commons.CommonUtil;
import com.manager.commons.DateUtil;

/**
 * 
 * Description:Usertable实体<br />
 * 
 * Version:V0.1<br />
 * 
 * Author: 左磊 QQ：30575951   <br />
 * 
 * History: <br />
 * 
 * 02/08/2012
 * 
 */
@Entity
@Table(name = "usertable")
public class Usertable implements IBaseBean {

	/** serialVersionUID */
	protected static final long serialVersionUID = -1L;

	public Usertable() {

	}

	@Id
	@Column(name = "id")
	private String id; // $field.label

	@Column(name = "rname")
	private String rname; // $field.label

	@Column(name = "username")
	private String username; // $field.label
	
	@Column(name = "password")
	private String password; // $field.label
	
	@Column(name = "sex")
	private String sex; // $field.label
	
	@Column(name = "school")
	private String school; // $field.label
	
	@Column(name = "education")
	private String education; // $field.label
	
	@Column(name = "level")
	private String level; // $field.label

	@Column(name = "specialty")
	private String specialty; // $field.label
	
	@Column(name = "oid")
	private String oid; // $field.label
	
	@Column(name = "org")
	private String org; // $field.label
	
	@Column(name = "birthday")
	private String birthday; // $field.label
	
	@Column(name = "tel")
	private String tel; // $field.label
	
	@Column(name = "EMAIL")
	private String EMAIL; // $field.label
	
	@Column(name = "QQ")
	private String QQ; // $field.label
	
	@Column(name = "createDate")
	private Date createDate; // $field.label
	
	@Column(name = "titles")
	private String titles; // $field.label
	
	@Transient
	private String role;
	
	@Transient
	private List<Role> roleList;
	
	@Transient
	private String isYFJL = "false";
	
	@Transient
	private String isFZR = "false";

	@Transient
	private String isFGFZ = "false";
	
	@Transient
	private String isZJL = "false";
	
	@Transient
	private String isYFZL = "false";
	
	@Transient
	private String isMoreYFJL = "false";
	
	@Transient
	private String isYFRY = "false";
	
	@Transient
	private String isLeader = "false";
	
	@Transient
	private int roleType;


	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the rname
	 */
	public String getRname() {
		return rname;
	}

	/**
	 * @param rname the rname to set
	 */
	public void setRname(String rname) {
		this.rname = rname;
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the sex
	 */
	public String getSex() {
		return sex;
	}

	/**
	 * @param sex the sex to set
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	 * @return the school
	 */
	public String getSchool() {
		return school;
	}

	/**
	 * @param school the school to set
	 */
	public void setSchool(String school) {
		this.school = school;
	}

	/**
	 * @return the education
	 */
	public String getEducation() {
		return education;
	}

	/**
	 * @param education the education to set
	 */
	public void setEducation(String education) {
		this.education = education;
	}

	/**
	 * @return the level
	 */
	public String getLevel() {
		return level;
	}

	/**
	 * @param level the level to set
	 */
	public void setLevel(String level) {
		this.level = level;
	}

	/**
	 * @return the specialty
	 */
	public String getSpecialty() {
		return specialty;
	}

	/**
	 * @param specialty the specialty to set
	 */
	public void setSpecialty(String specialty) {
		this.specialty = specialty;
	}

	/**
	 * @return the oid
	 */
	public String getOid() {
		return oid;
	}

	/**
	 * @param oid the oid to set
	 */
	public void setOid(String oid) {
		this.oid = oid;
	}

	/**
	 * @return the org
	 */
	public String getOrg() {
		return org;
	}

	/**
	 * @param org the org to set
	 */
	public void setOrg(String org) {
		this.org = org;
	}

	/**
	 * @return the birthday
	 */
	public String getBirthday() {
		return birthday;
	}

	/**
	 * @param birthday the birthday to set
	 */
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	/**
	 * @return the tel
	 */
	public String getTel() {
		return tel;
	}

	/**
	 * @param tel the tel to set
	 */
	public void setTel(String tel) {
		this.tel = tel;
	}

	/**
	 * @return the eMAIL
	 */
	public String getEMAIL() {
		return EMAIL;
	}

	/**
	 * @param email the eMAIL to set
	 */
	public void setEMAIL(String email) {
		EMAIL = email;
	}

	/**
	 * @return the qQ
	 */
	public String getQQ() {
		return QQ;
	}

	/**
	 * @param qq the qQ to set
	 */
	public void setQQ(String qq) {
		QQ = qq;
	}

	/**
	 * @return the createDate
	 */
	public Date getCreateDate() {
		return createDate;
	}

	/**
	 * @param createDate the createDate to set
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public List<Role> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<Role> roleList,String username) {
		this.roleList = roleList;
		if(username.equals("sys")){
			roleType = CommonUtil.POWER_VIEW_TYPE_3;
		}else{
		if(roleList!=null && roleList.size()>0){
			for (Role role : roleList) {
				if(role.getName().equals("研发经理")){
					isYFJL = "true";
					isMoreYFJL = "true";
				}
				if(role.getName().equals("研发中心负责人")){
					isFZR = "true";
					isMoreYFJL = "true";
				}
				if(role.getName().equals("分管副总")){
					isFGFZ = "true";
					isMoreYFJL = "true";
				}
				if(role.getName().equals("总经理")){
					isZJL = "true";
					isMoreYFJL = "true";
				}
				if(role.getName().equals("研发中心助理")){
					isYFZL = "true";
				}
				if(role.getName().equals("研发人员")){
					isYFRY = "true";
				}
			}
			if(isFGFZ.equals("true") || isZJL.equals("true")  || isYFJL.equals("true") || isFZR.equals("true")){
				isLeader = "true";
			}
			if(isFGFZ.equals("true") || isZJL.equals("true") ){
				roleType = CommonUtil.POWER_VIEW_TYPE_3;
			}else if(isFZR.equals("true") || isYFJL.equals("true") ||  isYFZL.equals("true")){
				roleType = CommonUtil.POWER_VIEW_TYPE_2;
			}else{
				roleType = CommonUtil.POWER_VIEW_TYPE_1;
			}
		}	
		}
	}

	public String getIsYFJL() {
		return isYFJL;
	}

	public void setIsYFJL(String isYFJL) {
		this.isYFJL = isYFJL;
	}

	public String getIsFZR() {
		return isFZR;
	}

	public void setIsFZR(String isFZR) {
		this.isFZR = isFZR;
	}

	public String getIsFGFZ() {
		return isFGFZ;
	}

	public void setIsFGFZ(String isFGFZ) {
		this.isFGFZ = isFGFZ;
	}

	public String getIsMoreYFJL() {
		return isMoreYFJL;
	}

	public void setIsMoreYFJL(String isMoreYFJL) {
		this.isMoreYFJL = isMoreYFJL;
	}

	public String getIsZJL() {
		return isZJL;
	}

	public void setIsZJL(String isZJL) {
		this.isZJL = isZJL;
	}

	public String getIsYFZL() {
		return isYFZL;
	}

	public void setIsYFZL(String isYFZL) {
		this.isYFZL = isYFZL;
	}

	public int getRoleType() {
		return roleType;
	}

	public void setRoleType(int roleType) {
		this.roleType = roleType;
	}

	public String getIsYFRY() {
		return isYFRY;
	}

	public void setIsYFRY(String isYFRY) {
		this.isYFRY = isYFRY;
	}

	public String getIsLeader() {
		return isLeader;
	}

	public void setIsLeader(String isLeader) {
		this.isLeader = isLeader;
	}

	/**
	 * @return the titles
	 */
	public String getTitles() {
		return titles;
	}

	/**
	 * @param titles the titles to set
	 */
	public void setTitles(String titles) {
		this.titles = titles;
	}





}
